//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __RBUF_H_
#define __RBUF_H_

typedef struct _MT_RBUF_ {
    UInt8*     pData;
    UInt32       cbSize;
    UInt32       cbType;
    UInt32       cbWrite;
    UInt32       dwIndex;
    DzMutex      Lock;
} MT_RBUF, *PMT_RBUF;

typedef struct _RBUF_ {
    UInt8* pData;
    UInt32   cbSize;
    UInt32   cbType;
    UInt32   dwWtIdx;//index attemp to write @For Reset This Index Set To 1
    UInt32   dwRdIdx;//index last read       @For Reset This Index Set To 0
} RBUF, *PRBUF;

EXTERN_C Boolean RBUF_MT_Init(PMT_RBUF pr, int cbSize, int cbType);
EXTERN_C void RBUF_MT_DeInit(PMT_RBUF pr);
EXTERN_C void RBUF_MT_Reset(PMT_RBUF pr);
EXTERN_C UInt32 RBUF_MT_EnQueue(PMT_RBUF pr, UInt8 *pData, UInt32 cbData);
EXTERN_C UInt32 RBUF_MT_DeQueue(PMT_RBUF pr, UInt8 *pData, UInt32 cbData);

EXTERN_C Boolean RBUF_Init(PRBUF pr, int cbSize, int cbType);
EXTERN_C void RBUF_DeInit(PRBUF pr);
EXTERN_C void RBUF_Reset(PRBUF pr);
EXTERN_C Boolean RBUF_IsEmpty(PRBUF pr);
EXTERN_C UInt32 RBUF_EnQueue(PRBUF pr, UInt8 *pData, UInt32 cbData);
EXTERN_C UInt32 RBUF_DeQueue(PRBUF pr, UInt8 *pData, UInt32 cbData);

#endif
